package com.tywj.navigation.entity

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName

/**
 * 城市实体类
 */
class CityEntity() : Parcelable {

    @SerializedName("city_code")
    var cityCode = ""

    @SerializedName("city_name")
    var cityName = ""


    var longitude = 0L

    var latitude = 0L


    constructor(parcel: Parcel) : this() {
        cityCode = parcel.readString()?: ""
        cityName = parcel.readString() ?: ""
        longitude = parcel.readLong()
        latitude = parcel.readLong()
    }

    override fun writeToParcel(dest: Parcel, flags: Int) {
        dest.writeString(cityCode)
        dest.writeString(cityName)
        dest.writeLong(longitude)
        dest.writeLong(latitude)
    }

    override fun describeContents(): Int = 0

    companion object CREATOR : Parcelable.Creator<CityEntity> {
        override fun createFromParcel(parcel: Parcel): CityEntity {
            return CityEntity(parcel)
        }

        override fun newArray(size: Int): Array<CityEntity?> {
            return arrayOfNulls(size)
        }
    }
}